package cate.game.play.skill.active;

import cate.game.play.buff.BuffParam;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.fighter.Fighter;
import cate.game.play.proce.action.ctx.SkillActionCtx;

/**
 * 随机对 4名敌人造成 880000真实伤害， 55%概率附加【眩晕】（无视抗控且最多 2名），并随机提升 2名友方单位 30%攻击 2回合
 */
public class 玄音铃珠AH extends ActiveHandler {

	private int 概率;

	private int buff;

	private int 人数;

	//概率=5500&buff=？？&人数=2
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		概率 = args.getInt("概率", 0);
		buff = args.getInt("buff", 0);
		人数 = args.getInt("人数", 0);
	}

	@Override
	public void onSkillDone(SkillActionCtx action) {
		int addNum = 0;
		BuffParam param = new BuffParam().ignAntiCtrlSet(true);
		for (Fighter target : action.getTargets()) {
			if (target.isDead()) {
				continue;
			}
			int buffPid = target.buff.tryAddByTid(action, skill.owner, buff, 概率, param);
			if (buffPid > 0) {
				addNum++;
				if (addNum >= 人数) {
					return;
				}
			}
		}
	}
}
